package co.edu.usbcali.egrapico.vista.tools;

import co.edu.usbcali.egrapico.vista.ambient.LabelIdeOpe;
import co.edu.usbcali.egrapico.vista.ambient.PanelRestrictionF;

public class JPanelTranferHandlerRestrictionF extends StringTransferHandler {

    protected void importString(javax.swing.JComponent c, String str) {
        PanelRestrictionF target = (PanelRestrictionF) c;
        boolean ban = true;
        try {
            target.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {
        }
        javax.swing.ImageIcon I0 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/add.gif"));
        javax.swing.ImageIcon I1 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/substract.gif"));
        javax.swing.ImageIcon I2 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/multiply.gif"));
        javax.swing.ImageIcon I3 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/divide.gif"));
        javax.swing.ImageIcon I4 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/equal.gif"));
        javax.swing.ImageIcon I5 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/greater.gif"));
        javax.swing.ImageIcon I6 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/greaterEqual.gif"));
        javax.swing.ImageIcon I7 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/minor.gif"));
        javax.swing.ImageIcon I8 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/minorEqual.gif"));
        javax.swing.ImageIcon I9 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/distinct.gif"));
        javax.swing.ImageIcon I10 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/value.gif"));
        javax.swing.ImageIcon I11 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/variable.gif"));
        javax.swing.ImageIcon I12 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/argument.gif"));
        javax.swing.ImageIcon I13 = new javax.swing.ImageIcon(getClass().getResource("/co/edu/usbcali/egrapico/images/forwardOperator.gif"));
        LabelIdeOpe label = new LabelIdeOpe();
        if (str.equals("Add") && target.getOperadoresMath() < 1) {
            for (int i = 0; i < target.getLPane().getComponentCount(); i++) {
                if (target.getLPane().getComponent(i) instanceof LabelIdeOpe) {
                    if (((LabelIdeOpe) target.getLPane().getComponent(i)).getId().equals("id3")) {
                        ban = false;
                    }
                }
            }
            if (ban) {
                label.setIcon(I0);
                label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
                label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
                label.setName(str);
                label.setSimbol("add.gif~+");
                label.setId("id3");
                label.setLocation(target.getLPane().getMousePosition());
                label.setSize(90, 100);
                target.addLayeredPane(label);
            }
        } else if (str.equals("Substract") && target.getOperadoresMath() < 1) {
            for (int i = 0; i < target.getLPane().getComponentCount(); i++) {
                if (target.getLPane().getComponent(i) instanceof LabelIdeOpe) {
                    if (((LabelIdeOpe) target.getLPane().getComponent(i)).getId().equals("id3")) {
                        ban = false;
                    }
                }
            }
            if (ban) {
                label.setIcon(I1);
                label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
                label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
                label.setName(str);
                label.setSimbol("substract.gif~-");
                label.setId("id3");
                label.setLocation(target.getLPane().getMousePosition());
                label.setSize(90, 100);
                target.addLayeredPane(label);
            }
        } else if (str.equals("Multiply") && target.getOperadoresMath() < 1) {
            for (int i = 0; i < target.getLPane().getComponentCount(); i++) {
                if (target.getLPane().getComponent(i) instanceof LabelIdeOpe) {
                    if (((LabelIdeOpe) target.getLPane().getComponent(i)).getId().equals("id3")) {
                        ban = false;
                    }
                }
            }
            if (ban) {
                label.setIcon(I2);
                label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
                label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
                label.setName(str);
                label.setSimbol("multiply.gif~*");
                label.setId("id3");
                label.setLocation(target.getLPane().getMousePosition());
                label.setSize(90, 100);
                target.addLayeredPane(label);
            }
        } else if (str.equals("Divide") && target.getOperadoresMath() < 1) {
            for (int i = 0; i < target.getLPane().getComponentCount(); i++) {
                if (target.getLPane().getComponent(i) instanceof LabelIdeOpe) {
                    if (((LabelIdeOpe) target.getLPane().getComponent(i)).getId().equals("id3")) {
                        ban = false;
                    }
                }
            }
            if (ban) {
                label.setIcon(I3);
                label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
                label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
                label.setName(str);
                label.setSimbol("divide.gif~/");
                label.setId("id3");
                label.setLocation(target.getLPane().getMousePosition());
                label.setSize(90, 100);
                target.addLayeredPane(label);
            }
        } else if (str.equals("Equal") && target.getOperadoresRel() < 1) {
            label.setIcon(I4);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setSimbol("equal.gif~=");
            label.setId("id1");
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 100);
            target.addLayeredPane(label);
        } else if (str.equals("Greater") && target.getOperadoresRel() < 1) {
            label.setIcon(I5);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setSimbol("greater.gif~>");
            label.setId("id1");
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 100);
            target.addLayeredPane(label);
        } else if (str.equals("Greater Equal") && target.getOperadoresRel() < 1) {
            label.setIcon(I6);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setSimbol("greaterEqual.gif~>=");
            label.setId("id1");
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 100);
            target.addLayeredPane(label);
        } else if (str.equals("Minor") && target.getOperadoresRel() < 1) {
            label.setIcon(I7);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setSimbol("minor.gif~<");
            label.setId("id1");
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 100);
            target.addLayeredPane(label);
        } else if (str.equals("Minor Equal") && target.getOperadoresRel() < 1) {
            label.setIcon(I8);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setSimbol("minorEqual.gif~<=");
            label.setId("id1");
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 100);
            target.addLayeredPane(label);
        } else if (str.equals("Distinct") && target.getOperadoresRel() < 1) {
            label.setIcon(I9);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setSimbol("distinct.gif~#");
            label.setId("id1");
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 100);
            target.addLayeredPane(label);
        } else if (str.equals("Value") && ((target.getOperadoresMath() == 1 && target.getIdentificadores() < 2)
                || (target.getOperadoresMath() == 0 && target.getIdentificadores() + target.getForwardOperator() < 2))) {
            label.setIcon(I10);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 90);
            target.addLayeredPane(label);
        } else if (str.equals("Variable") && ((target.getOperadoresMath() == 1 && target.getIdentificadores() < 2)
                || (target.getOperadoresMath() == 0 && target.getIdentificadores() + target.getForwardOperator() < 2))) {
            label.setIcon(I11);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 90);
            target.addLayeredPane(label);
        } else if (str.equals("Argument") && ((target.getOperadoresMath() == 1 && target.getIdentificadores() < 2)
                || (target.getOperadoresMath() == 0 && target.getIdentificadores() + target.getForwardOperator() < 2))) {
            label.setIcon(I12);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 90);
            target.addLayeredPane(label);
        } else if (str.equals("Forward") && ((target.getIdentificadores() < 3 && +target.getOperadoresMath() == 1)
                || (target.getIdentificadores() < 2 && target.getOperadoresMath() < 1)) && target.getForwardOperator() < 1) {
            label.setIcon(I13);
            label.setHorizontalTextPosition(javax.swing.JLabel.CENTER);
            label.setVerticalTextPosition(javax.swing.JLabel.BOTTOM);
            label.setName(str);
            label.setLocation(target.getLPane().getMousePosition());
            label.setSize(90, 90);
            target.addLayeredPane(label);
        }
    }
}